/**
 * "Visual Paradigm: DO NOT MODIFY THIS FILE!"
 * 
 * This is an automatic generated file. It will be regenerated every time 
 * you generate persistence class.
 * 
 * Modifying its content may cause the program not work, or your work may lost.
 */

/**
 * Licensee: nu uc
 * License Type: Evaluation
 */
package org.testis.orm.classes;

import org.orm.*;
import org.hibernate.Query;
import java.util.List;

public class T_test_devicegroupFactory {
    public static T_test_devicegroup loadT_test_devicegroupByORMID(int id)
	    throws PersistentException {
	try {
	    PersistentSession session = org.testis.orm.manager.TestisDbPersistentManager
		    .instance().getSession();
	    return loadT_test_devicegroupByORMID(session, id);
	} catch (Exception e) {
	    e.printStackTrace();
	    throw new PersistentException(e);
	}
    }

    public static T_test_devicegroup getT_test_devicegroupByORMID(int id)
	    throws PersistentException {
	try {
	    PersistentSession session = org.testis.orm.manager.TestisDbPersistentManager
		    .instance().getSession();
	    return getT_test_devicegroupByORMID(session, id);
	} catch (Exception e) {
	    e.printStackTrace();
	    throw new PersistentException(e);
	}
    }

    public static T_test_devicegroup loadT_test_devicegroupByORMID(int id,
	    org.hibernate.LockMode lockMode) throws PersistentException {
	try {
	    PersistentSession session = org.testis.orm.manager.TestisDbPersistentManager
		    .instance().getSession();
	    return loadT_test_devicegroupByORMID(session, id, lockMode);
	} catch (Exception e) {
	    e.printStackTrace();
	    throw new PersistentException(e);
	}
    }

    public static T_test_devicegroup getT_test_devicegroupByORMID(int id,
	    org.hibernate.LockMode lockMode) throws PersistentException {
	try {
	    PersistentSession session = org.testis.orm.manager.TestisDbPersistentManager
		    .instance().getSession();
	    return getT_test_devicegroupByORMID(session, id, lockMode);
	} catch (Exception e) {
	    e.printStackTrace();
	    throw new PersistentException(e);
	}
    }

    public static T_test_devicegroup loadT_test_devicegroupByORMID(
	    PersistentSession session, int id) throws PersistentException {
	try {
	    return (T_test_devicegroup) session.load(
		    org.testis.orm.classes.T_test_devicegroup.class,
		    new Integer(id));
	} catch (Exception e) {
	    e.printStackTrace();
	    throw new PersistentException(e);
	}
    }

    public static T_test_devicegroup getT_test_devicegroupByORMID(
	    PersistentSession session, int id) throws PersistentException {
	try {
	    return (T_test_devicegroup) session.get(
		    org.testis.orm.classes.T_test_devicegroup.class,
		    new Integer(id));
	} catch (Exception e) {
	    e.printStackTrace();
	    throw new PersistentException(e);
	}
    }

    public static T_test_devicegroup loadT_test_devicegroupByORMID(
	    PersistentSession session, int id, org.hibernate.LockMode lockMode)
	    throws PersistentException {
	try {
	    return (T_test_devicegroup) session.load(
		    org.testis.orm.classes.T_test_devicegroup.class,
		    new Integer(id), lockMode);
	} catch (Exception e) {
	    e.printStackTrace();
	    throw new PersistentException(e);
	}
    }

    public static T_test_devicegroup getT_test_devicegroupByORMID(
	    PersistentSession session, int id, org.hibernate.LockMode lockMode)
	    throws PersistentException {
	try {
	    return (T_test_devicegroup) session.get(
		    org.testis.orm.classes.T_test_devicegroup.class,
		    new Integer(id), lockMode);
	} catch (Exception e) {
	    e.printStackTrace();
	    throw new PersistentException(e);
	}
    }

    public static T_test_devicegroup[] listT_test_devicegroupByQuery(
	    String condition, String orderBy) throws PersistentException {
	try {
	    PersistentSession session = org.testis.orm.manager.TestisDbPersistentManager
		    .instance().getSession();
	    return listT_test_devicegroupByQuery(session, condition, orderBy);
	} catch (Exception e) {
	    e.printStackTrace();
	    throw new PersistentException(e);
	}
    }

    public static T_test_devicegroup[] listT_test_devicegroupByQuery(
	    String condition, String orderBy, org.hibernate.LockMode lockMode)
	    throws PersistentException {
	try {
	    PersistentSession session = org.testis.orm.manager.TestisDbPersistentManager
		    .instance().getSession();
	    return listT_test_devicegroupByQuery(session, condition, orderBy,
		    lockMode);
	} catch (Exception e) {
	    e.printStackTrace();
	    throw new PersistentException(e);
	}
    }

    public static T_test_devicegroup[] listT_test_devicegroupByQuery(
	    PersistentSession session, String condition, String orderBy)
	    throws PersistentException {
	StringBuffer sb = new StringBuffer(
		"From org.testis.orm.classes.T_test_devicegroup as T_test_devicegroup");
	if (condition != null)
	    sb.append(" Where ").append(condition);
	if (orderBy != null)
	    sb.append(" Order By ").append(orderBy);
	try {
	    Query query = session.createQuery(sb.toString());
	    List list = query.list();
	    return (T_test_devicegroup[]) list
		    .toArray(new T_test_devicegroup[list.size()]);
	} catch (Exception e) {
	    e.printStackTrace();
	    throw new PersistentException(e);
	}
    }

    public static T_test_devicegroup[] listT_test_devicegroupByQuery(
	    PersistentSession session, String condition, String orderBy,
	    org.hibernate.LockMode lockMode) throws PersistentException {
	StringBuffer sb = new StringBuffer(
		"From org.testis.orm.classes.T_test_devicegroup as T_test_devicegroup");
	if (condition != null)
	    sb.append(" Where ").append(condition);
	if (orderBy != null)
	    sb.append(" Order By ").append(orderBy);
	try {
	    Query query = session.createQuery(sb.toString());
	    query.setLockMode("this", lockMode);
	    List list = query.list();
	    return (T_test_devicegroup[]) list
		    .toArray(new T_test_devicegroup[list.size()]);
	} catch (Exception e) {
	    e.printStackTrace();
	    throw new PersistentException(e);
	}
    }

    public static T_test_devicegroup loadT_test_devicegroupByQuery(
	    String condition, String orderBy) throws PersistentException {
	try {
	    PersistentSession session = org.testis.orm.manager.TestisDbPersistentManager
		    .instance().getSession();
	    return loadT_test_devicegroupByQuery(session, condition, orderBy);
	} catch (Exception e) {
	    e.printStackTrace();
	    throw new PersistentException(e);
	}
    }

    public static T_test_devicegroup loadT_test_devicegroupByQuery(
	    String condition, String orderBy, org.hibernate.LockMode lockMode)
	    throws PersistentException {
	try {
	    PersistentSession session = org.testis.orm.manager.TestisDbPersistentManager
		    .instance().getSession();
	    return loadT_test_devicegroupByQuery(session, condition, orderBy,
		    lockMode);
	} catch (Exception e) {
	    e.printStackTrace();
	    throw new PersistentException(e);
	}
    }

    public static T_test_devicegroup loadT_test_devicegroupByQuery(
	    PersistentSession session, String condition, String orderBy)
	    throws PersistentException {
	T_test_devicegroup[] t_test_devicegroups = listT_test_devicegroupByQuery(
		session, condition, orderBy);
	if (t_test_devicegroups != null && t_test_devicegroups.length > 0)
	    return t_test_devicegroups[0];
	else
	    return null;
    }

    public static T_test_devicegroup loadT_test_devicegroupByQuery(
	    PersistentSession session, String condition, String orderBy,
	    org.hibernate.LockMode lockMode) throws PersistentException {
	T_test_devicegroup[] t_test_devicegroups = listT_test_devicegroupByQuery(
		session, condition, orderBy, lockMode);
	if (t_test_devicegroups != null && t_test_devicegroups.length > 0)
	    return t_test_devicegroups[0];
	else
	    return null;
    }

    public static java.util.Iterator iterateT_test_devicegroupByQuery(
	    String condition, String orderBy) throws PersistentException {
	try {
	    PersistentSession session = org.testis.orm.manager.TestisDbPersistentManager
		    .instance().getSession();
	    return iterateT_test_devicegroupByQuery(session, condition, orderBy);
	} catch (Exception e) {
	    e.printStackTrace();
	    throw new PersistentException(e);
	}
    }

    public static java.util.Iterator iterateT_test_devicegroupByQuery(
	    String condition, String orderBy, org.hibernate.LockMode lockMode)
	    throws PersistentException {
	try {
	    PersistentSession session = org.testis.orm.manager.TestisDbPersistentManager
		    .instance().getSession();
	    return iterateT_test_devicegroupByQuery(session, condition,
		    orderBy, lockMode);
	} catch (Exception e) {
	    e.printStackTrace();
	    throw new PersistentException(e);
	}
    }

    public static java.util.Iterator iterateT_test_devicegroupByQuery(
	    PersistentSession session, String condition, String orderBy)
	    throws PersistentException {
	StringBuffer sb = new StringBuffer(
		"From org.testis.orm.classes.T_test_devicegroup as T_test_devicegroup");
	if (condition != null)
	    sb.append(" Where ").append(condition);
	if (orderBy != null)
	    sb.append(" Order By ").append(orderBy);
	try {
	    Query query = session.createQuery(sb.toString());
	    return query.iterate();
	} catch (Exception e) {
	    e.printStackTrace();
	    throw new PersistentException(e);
	}
    }

    public static java.util.Iterator iterateT_test_devicegroupByQuery(
	    PersistentSession session, String condition, String orderBy,
	    org.hibernate.LockMode lockMode) throws PersistentException {
	StringBuffer sb = new StringBuffer(
		"From org.testis.orm.classes.T_test_devicegroup as T_test_devicegroup");
	if (condition != null)
	    sb.append(" Where ").append(condition);
	if (orderBy != null)
	    sb.append(" Order By ").append(orderBy);
	try {
	    Query query = session.createQuery(sb.toString());
	    query.setLockMode("this", lockMode);
	    return query.iterate();
	} catch (Exception e) {
	    e.printStackTrace();
	    throw new PersistentException(e);
	}
    }

    public static T_test_devicegroup createT_test_devicegroup() {
	return new org.testis.orm.classes.T_test_devicegroup();
    }

    public static T_test_devicegroup loadT_test_devicegroupByCriteria(
	    T_test_devicegroupCriteria t_test_devicegroupCriteria) {
	T_test_devicegroup[] t_test_devicegroups = listT_test_devicegroupByCriteria(t_test_devicegroupCriteria);
	if (t_test_devicegroups == null || t_test_devicegroups.length == 0) {
	    return null;
	}
	return t_test_devicegroups[0];
    }

    public static T_test_devicegroup[] listT_test_devicegroupByCriteria(
	    T_test_devicegroupCriteria t_test_devicegroupCriteria) {
	return t_test_devicegroupCriteria.listT_test_devicegroup();
    }
}
